<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>职位编辑</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="Hosting Store Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template,
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
    <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>

    <%--<link href="${pageContext.request.contextPath}/static/admin/assets/css/minimal.css" rel="stylesheet"/>--%>
    <%--<link href="${pageContext.request.contextPath}/static/admin/assets/css/vendor/bootstrap/bootstrap.min.css" rel="stylesheet"/>--%>
    <link href="${pageContext.request.contextPath}/static/home/css/bootstrap.css" rel='stylesheet' type='text/css' />

    <script src="${pageContext.request.contextPath}/static/home/js/jquery-1.11.1.min.js"></script>
    <%--<script src="${pageContext.request.contextPath}/static/admin/assets/js/vendor/bootstrap/bootstrap.min.js"></script>--%>
    <!-- Custom Theme files -->
    <link href="${pageContext.request.contextPath}/static/home/css/edit_user_info_css.css" rel='stylesheet' type='text/css' />
    <!-- Custom Theme files -->

    <!-- webfonts -->
    <link href='${pageContext.request.contextPath}/static/home/css/font-awesome.css' rel='stylesheet' type='text/css'/>
    <!-- webfonts -->
    <!-- dropdown -->
    <script src="${pageContext.request.contextPath}/static/home/js/jquery.easydropdown.js"></script>
    <script src="${pageContext.request.contextPath}/static/home/js/jquery-labelauty.js"></script>

    <link href="${pageContext.request.contextPath}/static/home/css/nav.css" rel="stylesheet" type="text/css" media="all"/>
    <link href="${pageContext.request.contextPath}/static/home/css/jquery-labelauty.css" rel='stylesheet' type='text/css' />
    <link href="${pageContext.request.contextPath}/static/home/css/passwordStyle.css" rel='stylesheet' type='text/css' />
    <link href="${pageContext.request.contextPath}/static/admin/css/sweetalert.css" rel="stylesheet">

    <link href="${pageContext.request.contextPath}/static/home/css/new_jobs.css" rel='stylesheet' type='text/css' />
    <link href="${pageContext.request.contextPath}/static/home/css/daterangepicker-bs3.css" rel='stylesheet' type='text/css' />
    <link href="${pageContext.request.contextPath}/static/home/css/daterangepicker-1.3.7.css" rel='stylesheet' type='text/css' />

    <!-- start-smoth-scrolling -->
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/move-top.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/easing.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/bootstrapValidator.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/moment.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/daterangepicker-1.3.7.js"></script>

    <script src="${pageContext.request.contextPath}/static/admin/js/sweetalert.min.js"></script>
    <!-- start-smoth-scrolling -->
    <!-- webfonts -->
    <%--<link href='http://fonts.useso.com/css?family=Ubuntu:300,400,500,700' rel='stylesheet' type='text/css'>--%>
    <!-- webfonts -->
    <!-- start-smoth-scrolling -->
    <script type="text/javascript">
        jQuery(document).ready(function($) {
            $(".scroll").click(function(event){
                event.preventDefault();
                $('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
            });
        });
    </script>
    <!-- end-smoth-scrolling -->
    <style>
        ul.a { list-style-type: none;}
        li.a { display: inline-block;}
        li.a { margin: 10px 0;}
        input.labelauty + label { font: 12px "Microsoft Yahei";}
        .fadeInLeft .labelauty-checked{
            color: #FFFFFF;
        }

        small{
            position: relative;
            top: 5px;
            left:17%;
        }
        .msg{
            color: #a94442;
        }
    </style>
</head>
<!-- Header Starts Here -->
<div class="banner inner-banner" >
    <%@include file="../header.jsp"%>

    <div id="breadcrumb_wrapper">
        <div class="container">

            <h3><strong>职位编辑</strong></h3>
            <h6>&nbsp;</h6>

            <div class="clearfix"></div>
        </div>
    </div>
</div>
<div class="clearfix"> </div>
<!-- Header Ends Here -->

<!--Main Starts Here-->
<div class="register-content">
<div class="container">
    <div class="register register-but" >
        <form class="form-job" action="${pageContext.request.contextPath}/home/job/save.action" enctype="multipart/form-data" method="post">
            <div class="register-top-grid">

                <input type="hidden" name="job_id" value="${job.job_id}">
                <div class="wow fadeInLeft" data-wow-delay="0.4s">
                    <span class="floatLeft">职位性质<label>*</label></span>
                    <ul class="a">
                        <c:forEach items="${jobPropertyList}" var="item">
                            <li class="a"><input type="radio" name="job_property_id" value="${item.job_property_id}" data-labelauty="${item.job_property_name}" <c:if test="${job.job_property_id==item.job_property_id}">checked</c:if> ></li>
                        </c:forEach>
                    </ul>
                </div>
                <div class="wow fadeInRight form-group" data-wow-delay="0.4s">
                    <span class="floatLeft">职位名称<label>*</label></span>
                    <input type="text"  style="width: 83%" name="job_name" value="<c:if test="${job.job_name != null}">${job.job_name}</c:if>">
                </div>

                <div class="wow fadeInRight" data-wow-delay="0.4s">
                    <span class="floatLeft">职位类别<label>*</label></span>
                        <span class="input-group-btn" >
                        <select id="industry" class="btn btn-default" name="industry" style="margin-top: 100%;" onchange="changeJobType('industry','jobType')">
                            <c:forEach items="${industryList}" var="item">
                                <option value="${item.industry_id}" <c:if test="${item.industry_id==job.jobType.industry_id}">selected</c:if> >${item.industry_name}</option>
                            </c:forEach>
                        </select>
                        </span>

                    <span class="input-group-btn" style="margin-left: 16%">
                        <select id="jobType" class="btn btn-default" name="job_type_id" style="margin-top: 100%;">
                            <c:forEach items="${jobTypeList}" var="item">
                                <option value="${item.job_type_id}" <c:if test="${item.job_type_id==job.job_type_id}">selected</c:if> >${item.job_type_name}</option>
                            </c:forEach>
                        </select>
                        </span>
                </div>
                <div class="wow fadeInRight" data-wow-delay="0.4s">
                    <span class="floatLeft">发布地点<label>*</label></span>
                        <span class="input-group-btn" >
                        <select id="zone" class="btn btn-default" style="margin-top: 100%;" onchange="changeCity('zone','city')">
                            <c:forEach items="${zoneList}" var="item">
                                <option value="${item.zone_id}" <c:if test="${item.zone_id==job.city.zone_id}">selected</c:if> >${item.name}</option>
                            </c:forEach>
                        </select>
                        </span>

                    <span class="input-group-btn" style="margin-left: 16%">
                        <select id="city" class="btn btn-default" name="city_id" style="margin-top: 100%;">
                            <c:forEach items="${cityList}" var="item">
                                <option value="${item.city_id}" <c:if test="${item.city_id==job.city_id}">selected</c:if> >${item.name}</option>
                            </c:forEach>
                        </select>
                    </span>
                </div>
                <div  class="wow fadeInLeft form-group" data-wow-delay="0.4s">
                    <span class="floatLeft">招聘要求<label>*</label></span>
                    <input type="text"  style="width:10%" class="col-md-3" name="number" value="<c:if test="${job.number!=null}">${job.number}</c:if>">
                    <span class="col-md-1" style="margin-top:2%;">人</span>
                        <span class="input-group-btn col-md-3" style="margin-top: 0.6%">
                            <select class="btn btn-default" name="degree_id">
                                <c:forEach items="${degreeList}" var="item">
                                    <option value="${item.degree_id}" <c:if test="${item.degree_id==job.degree_id}">selected</c:if> >${item.degree_name}</option>
                                </c:forEach>
                            </select>
                            含以上
                        </span>
                    <span class="col-md-3"></span>
                        <span class="input-group-btn col-md-1" style="margin-top: 0.6%">
                            <select class="btn btn-default" name="work_year">
                                <option value="0" <c:if test="${job.work_year=='0'}">selected</c:if> >经验不限</option>
                                <option value="1" <c:if test="${job.work_year=='1'}">selected</c:if>>一年以上</option>
                                <option value="2" <c:if test="${job.work_year=='2'}">selected</c:if>>两年以上</option>
                                <option value="3" <c:if test="${job.work_year=='3'}">selected</c:if>>三年以上</option>
                                <option value="4" <c:if test="${job.work_year=='4'}">selected</c:if>>四年以上</option>
                                <option value="5" <c:if test="${job.work_year=='5'}">selected</c:if>>五年以上</option>
                            </select>
                        </span>
                </div>

            </div>

            <div class="register-bottom-grid">
                <h3> </h3>
                <div class="wow fadeInLeft" data-wow-delay="0.4s">
                    <span class="floatLeft" style="margin-top: 0">职位月薪<label>*</label></span>
                        <span class="input-group-btn  col-md-6"  >
                        <select class="btn btn-default" name="salary_type_id" style="margin-top: -92%">
                           <c:forEach items="${salaryTypeList}" var="item">
                               <option value="${item.salary_type_id}" <c:if test="${job.salary_type_id==item.salary_type_id}">selected</c:if>>${item.value}</option>
                           </c:forEach>
                        </select>
                        </span>
                    <span class="col-md-3"></span>
                    <span class="input-group-btn col-md-6"  >
                        是否显示
                        <select class="btn btn-default" name="show_salary" style="margin-top: -92%">
                           <option value="0" <c:if test="${job.show_salary=='0'}">selected</c:if>>否</option>
                           <option value="1" <c:if test="${job.show_salary=='1'}">selected</c:if>>是</option>
                        </select>
                        </span>
                    <br><br>
                </div>

                <div class="wow fadeInLeft form-group" data-wow-delay="0.4s">
                    <span class="floatLeft">职位描述<label>*</label></span>
                    <textarea   rows="6" cols="48" name="job_description"><c:if test="${job.job_description != null}">${job.job_description}</c:if> </textarea>
                </div>

                <div class="wow fadeInLeft" data-wow-delay="0.4s">
                    <span class="floatLeft">职位标签<label>*</label></span>
                    <ul class="dowebok col-md-10 a">
                        <c:forEach items="${jobTagList}" var="item">
                            <li class="a"><input type="checkbox" name="tag" value="${item.job_tag_id}" data-labelauty="${item.job_tag_name}" <c:forEach items="${tagList}" var="item2"><c:choose><c:when test="${item.job_tag_id==item2.tag_id}">checked</c:when></c:choose></c:forEach> ></li>
                        </c:forEach>
                    </ul>
                </div>
                <br>

                <div class="wow fadeInRight form-group" data-wow-delay="0.4s">
                    <span class="floatLeft">工作地址<label>*</label></span>
                    <input type="text" style="width: 83%" name="address" value="<c:if test="${job.address != null}">${job.address}</c:if>">
                </div>

                <div class="wow fadeInRight" data-wow-delay="0.4s">
                    <span class="floatLeft" style="margin-top: 4%">发布时间<label>*</label></span>
                    <div id="reportrange" class="dateRange btn btn-default btn-sm m-r-lg">
                        <i class="fa fa-calendar"></i>
                        选择时间
                        <span id="searchDateRange"><c:if test="${job.date_start_string!=null}">${job.date_start_string} to ${job.date_end_string}</c:if> </span>
                        <b class="caret" style="margin-top: -5%"></b>
                    </div>
                </div>
                <input type="hidden" id="date_start_string" name="date_start_string" value="${job.date_start_string}">
                <input type="hidden" id="date_end_string" name="date_end_string" value="${job.date_end_string}">
                <div class="wow fadeInRight" data-wow-delay="0.4s">
                    <span class="floatLeft">是否发布<label>*</label></span>
                    <span class="input-group-btn">
                        <select class="btn btn-default" name="is_publish" >
                           <option value="0" <c:if test="${job.is_publish=='0'}">selected</c:if>>否</option>
                           <option value="1" <c:if test="${job.is_publish=='1'}">selected</c:if>>是</option>
                        </select>
                        </span>
                </div>
                <span style="color: red"><strong>尊敬的客户，职位发布成功后，截止日期将无法修改，请确认信息后再发布</strong></span>

            </div>
            <div class="register-but">
                <input type="submit" value="确认并发布">
        </div>
        </form>
    </div>
</div>
</div>
<!--Main Ends Here-->


<!-- #Footer -->
<%@include file="../footer.jsp"%>
<!-- /#Footer -->
<!-- here stars scrolling icon -->
<script type="text/javascript">

    <c:if test="${error == 1}">
        swal("","服务器出错！","error");
    </c:if>

    <c:choose>
        <c:when test="${status==0}">
            swal("","该企业账号已被封号,请联系客服了解详情","error");
        </c:when>
        <c:when test="${detailStatus==0}">
            swal("","企业信息仍在审核中!!!","error");
        </c:when>
        <c:when test="${detailStatus==2}">
            swal("","企业信息审核不通过!!!","error");
        </c:when>
    </c:choose>

    <c:if test="${success == 1}">
    swal({
        title: "",
        text: "发布成功！",
        type: "success",
        showCancelButton: false,
        closeOnConfirm: true,
        confirmButtonText: "确定"
    }, function() {
        window.location.href="${pageContext.request.contextPath}/home/job/index.action";
    });
    setTimeout(function(){
        window.location.href="${pageContext.request.contextPath}/home/job/index.action";
    },3000);
    </c:if>

    $(document).ready(function() {
        /*
         var defaults = {
         containerID: 'toTop', // fading element id
         containerHoverID: 'toTopHover', // fading element hover id
         scrollSpeed: 1200,
         easingType: 'linear'
         };
         */

        $().UItoTop({ easingType: 'easeOutQuart' });

    });


</script>

<script>
    function changeJobType(id1,id2){
        var industry_id = $('#'+id1).val();
        $.ajax({
            type:'post',
            url:'${pageContext.request.contextPath}/home/job/changeJobType.action',
            data: 'industry_id='+ industry_id,
            success:function(data){
                var string="";
                for(var i in data){
                    string += '<option value="'+data[i].job_type_id+'">'+data[i].job_type_name+'</option>';
                }
                $('#'+id2).html(string);
                $('#'+id2).trigger("chosen:updated");
            }
        })
    }
    changeCity('zone','city');
    function changeCity(id1,id2){
        var zone_id = $('#'+id1).val();
        $.ajax({
            type:'post',
            url:'${pageContext.request.contextPath}/home/job/changeCity.action',
            data: 'zone_id='+ zone_id,
            success:function(data){
                var string="";
                for(var i in data){
                    string += '<option value="'+data[i].city_id+'">'+data[i].name+'</option>';
                }
                $('#'+id2).html(string);
                $('#'+id2).trigger("chosen:updated");
            }
        })
    }
</script>

<script>
    $(document).ready(function (){
        //时间插件
//    $('#reportrange span').html('{$startDate}' + ' - ' + '{$endDate}');
        $('#reportrange').daterangepicker(
                {
                    // startDate: moment().startOf('day'),
                    //endDate: moment(),
                    //minDate: '01/01/2012',    //最小时间
//                        maxDate : moment(), //最大时间
                    dateLimit : {
                        days : 100
                    }, //起止时间的最大间隔
                    showDropdowns : true,
                    showWeekNumbers : false, //是否显示第几周
                    timePicker : false, //是否显示小时和分钟
                    timePickerIncrement : 60, //时间的增量，单位为分钟
                    timePicker12Hour : false, //是否使用12小时制来显示时间
//                    ranges : {
//                        //'最近1小时': [moment().subtract('hours',1), moment()],
//                        '今日': [moment().startOf('day'), moment()],
//                        '昨日': [moment().subtract('days', 1).startOf('day'), moment().subtract('days', 1).endOf('day')],
//                        '最近7日': [moment().subtract('days', 6), moment()],
//                        '最近30日': [moment().subtract('days', 29), moment()],
//                        '上个月': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')],
//                        '这个月': [moment().startOf('month'), moment()]
//                    },
                    opens : 'right', //日期选择框的弹出位置
                    buttonClasses : [ 'btn btn-default' ],
                    applyClass : 'btn-small btn-primary blue',
                    cancelClass : 'btn-small',
                    format : 'YYYY/MM/DD', //控件中from和to 显示的日期格式
                    separator : ' to ',
                    locale : {
                        applyLabel : '确定',
                        cancelLabel : '取消',
                        fromLabel : '起始时间',
                        toLabel : '结束时间',
                        customRangeLabel : '自定义',
                        daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],
                        monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月',
                            '七月', '八月', '九月', '十月', '十一月', '十二月' ],
                        firstDay : 1
                    }
                }, function(start, end, label){
                    $('#reportrange span').html(start.format('YYYY/MM/DD') + ' - ' + end.format('YYYY/MM/DD'));
                    var startDate = start.format('YYYY-MM-DD HH:mm:ss');
                    var endDate = end.format('YYYY-MM-DD HH:mm:ss');
                    $('#date_start_string').val(startDate);
                    $('#date_end_string').val(endDate);
                });

        //设置日期菜单被选项  --开始--
        /*
         var dateOption ;
         if("${riqi}"=='day') {
         dateOption = "今日";
         }else if("${riqi}"=='yday') {
         dateOption = "昨日";
         }else if("${riqi}"=='week'){
         dateOption ="最近7日";
         }else if("${riqi}"=='month'){
         dateOption ="最近30日";
         }else if("${riqi}"=='year'){
         dateOption ="最近一年";
         }else{
         dateOption = "自定义";
         }
         $(".daterangepicker").find("li").each(function (){
         if($(this).hasClass("active")){
         $(this).removeClass("active");
         }
         if(dateOption==$(this).html()){
         $(this).addClass("active");
         }
         });*/
        //设置日期菜单被选项  --结束--
    });
</script>

<script>
    $(function(){
        $(':input').labelauty();
        $('.form-group').data('bootstrapValidator', null);
        $('.form-job').bootstrapValidator({
            message: 'This value is not valid',
            fields:{
                job_name:{
                    validators: {
                        notEmpty: {
                            message: '企业名称不能为空'
                        }
                    }
                },
                number:{
                    validators: {
                        notEmpty: {
                            message: '招聘人数不能为空'
                        }
                    }
                },
                job_description:{
                    validators: {
                        notEmpty: {
                            message: '职位描述不能为空'
                        }
                    }
                },
                address:{
                    validators: {
                        notEmpty: {
                            message: '工作地址不能为空'
                        }
                    }
                },
            }

        });
    });
</script>

<script>

</script>

<!-- //here ends scrolling icon -->
</body>
</html>
